package com.itheima.Movinformationdisplay;

import java.util.Objects;
import java.util.Scanner;

public class movieoperator
{
    movie[] movies ;
    public movieoperator() {}
    public movieoperator(movie[] movies)
    {
        this.movies = movies;
    }
    public void printAll()
    {
        for(int i=0;i<movies.length;i++)
        {
            System.out.println(movies[i].getName()+"  "+movies[i].getPrice()+"  "+movies[i].getStar());
        }
    }
   public void show()
   {
       Scanner sc = new Scanner(System.in);
       System.out.println("请输入你要查询的编号");
       String id = sc.next();
       for(int i=0;i<movies.length;i++)
       {
           if(Objects.equals(id, movies[i].getId()))
           {
               System.out.println(movies[i].getName()+"  "+movies[i].getPrice()+"  "+movies[i].getStar());
               return;
           }
       }
       System.out.println("没有此编号");
   }
}

